
<%@page import="com.sinba.common.user.dto.RegUserBasicDTO"%>
<%@page import="com.sinba.common.user.service.IRegisterUserService"%>
<%@page import="org.springframework.web.context.support.WebApplicationContextUtils"%>
<%@page import="org.springframework.context.ApplicationContext"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> 
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ include file="../language.jsp" %>

<%
if(session.getAttribute("password2")==null){
	response.sendRedirect( "login2.jsp?pageUrl=user/pi.jsp");
	return;
}

ApplicationContext ac = WebApplicationContextUtils.getWebApplicationContext(getServletContext());
IRegisterUserService registerUserService = (IRegisterUserService)ac.getBean("registerUserService");
RegUserBasicDTO rubDTO = registerUserService.findRegUserBasicInfo((String)session.getAttribute("loginName"));
request.setAttribute("rubDTO",rubDTO);

%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title><fmt:message key="i18n.userInfo"/>-<fmt:message key="i18n.title"/></title>
<link rel="shortcut icon" href="../index/favicon.png" />
<link href="../skin/skin1/css/subPage.css" rel="stylesheet">
<link rel="stylesheet" href="css/sub_page_main_style.css" />
</head>
<body style="background:#ede3d1;height:800px;">
<div class="account">
	<div class="top"><fmt:message key="i18n.userCenter"/> &gt; <fmt:message key="i18n.updateUserInfo"/>
	 </div>
	<!-- <div class="left"></div> -->
    <div class="right" >
    <form id="updateInfo_form" action="registerUser!changeRegUserBasicInfo.action" method="post" onsubmit="return changeBasicInfo();">
    	<input type="hidden" name="rubDTO.loginName" value="${rubDTO.loginName }" />
       	<input type="hidden" type="hidden" name="rubDTO.registerUserId" value="${rubDTO.registerUserId }" />
       	<input type="hidden" name="rubDTO.qq" value="${rubDTO.qq }" />
       	<input type="hidden" name="rubDTO.email" value="${rubDTO.email }" />
       	<input type="hidden"  name="pageUrl" value="pi.jsp" />
    	<table id="pitable" width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td align="right"><fmt:message key="i18n.piUserName"/>：</td>
				<td align="left"><input name="rubDTO.userName" id="pi_userName" class="srk100 easyui-validatebox" readonly="readonly" value="${rubDTO.userName }" /><label class="tip100">*</label></td>
			</tr>
		<%-- 	<tr>
				<td align="right"><fmt:message key="i18n.piEmail"/>：</td>
				<td align="left"><input name="rubDTO.email" id="pi_email" class="srk100 easyui-validatebox" readonly="readonly" value="${rubDTO.email }" /><label class="tip100">*</label></td>
			</tr> --%>
			<tr>
				<td align="right"><fmt:message key="i18n.openUserBank"/>：</td>
				<td align="left">
					<select class="srk100 regSele" id="accountType" name="rubDTO.accountType" >
						<option value="中国农业银行" <c:if test="${rubDTO.accountType eq '中国农业银行' }">selected</c:if>><fmt:message key="i18n.abcBank"/></option>
						<option value="中国工商银行" <c:if test="${rubDTO.accountType eq '中国工商银行' }">selected</c:if>><fmt:message key="i18n.gongBank"/></option>
						<option value="中国建设银行" <c:if test="${rubDTO.accountType eq '中国建设银行' }">selected</c:if>><fmt:message key="i18n.ccbBank"/></option>
						<option value="中国银行" <c:if test="${rubDTO.accountType eq '中国银行' }">selected</c:if>><fmt:message key="i18n.chinaBank"/></option>
						<option value="财付通" <c:if test="${rubDTO.accountType eq '财付通' }">selected</c:if>><fmt:message key="i18n.caifutong"/></option>
						<option value="支付宝" <c:if test="${rubDTO.accountType eq '支付宝' }">selected</c:if>>支付宝</option>
					</select>
					<span style="color:red;"></span>
				</td>
			</tr>
			<tr>
				<td align="right"><fmt:message key="i18n.piBrankAccount"/>：</td>
				<td align="left"><input name="rubDTO.bankAccount" class="srk100 easyui-validatebox" required="true" value="${rubDTO.bankAccount }" /></td>
			</tr>
			<tr>
				<td align="right"><fmt:message key="i18n.openBankAddress"/>：</td>
				<td align="left">
				<input class="srk100" name="rubDTO.openBankAddress"  value="${rubDTO.openBankAddress }" /></td>
			</tr>
			<tr>
				<td align="right"><fmt:message key="i18n.piMobile"/>：</td>
				<td align="left"><input name="rubDTO.phone" class="srk100 easyui-validatebox" required="true" value="${rubDTO.phone}" /></td>
			</tr>
			<%-- <tr>
			<td colspan="1" align="center"></td>
			<td colspan="1" align="left" class="srktip100"><fmt:message key="i18n.updatePwdReq" /></td>
			</tr>
			<tr>
				<td align="right"><fmt:message key="i18n.new" />&nbsp;<fmt:message key="i18n.ptype" />：</td>
				<td>
					<select class="srk100" name="rubDTO.newPwdProblem">
						<jsp:include page="PwdProblem.jsp"></jsp:include>
					</select>
				</td>
			</tr>
			<tr>
				<td align="right"><fmt:message key="i18n.new" />&nbsp;<fmt:message key="i18n.answer" />：</td>
				<td align="left"><input class="srk100" name="rubDTO.newPwdAnswer" /><span class="srktip100">（<fmt:message key="i18n.updatePwdReqTip" />）</span></td>
			</tr>
			<tr>
			<td colspan="1" align="center">&nbsp;</td>
			<td colspan="1" align="left" class="srktip100"> <fmt:message key="i18n.secretSecurityTip"/> </td>
			</tr>
			
			<tr>
				<td align="right"><fmt:message key="i18n.ptype" />：</td>
				<td>
					<select class="srk100" name="rubDTO.passwordProblem">
						<jsp:include page="PwdProblem.jsp"></jsp:include>
					</select>
				</td>
			</tr>
			<tr>
				<td align="right"> <fmt:message key="i18n.answer" />：</td>
				<td align="left"><input class="srk100" id="pi_passwordAnswer" name="rubDTO.passwordAnswer" /><label class="tip100">*</label></td>
			</tr> --%>
			<%-- <tr>
       			<td align="right"><fmt:message key="i18n.valicode"/>:</td>
       			<td align="left">
       			<input class="easyui-validatebox" id="pi_validCode" />
       			<input type="hidden" value="${session.loginName }" id="pi_loginName" />
        			<input type="button" value="<fmt:message key="i18n.getEmailValiCode"/>" id="pi_loginName_button" onclick="getEmailActivationCode('邮件','UpdateUser','#pi_loginName')"> 
 						<span style="color:red;" id="pi_loginName_show"></span>
       			</td>
       		</tr> --%>
       		
       		<tr>
				<td></td>
				<td>
					<span ><fmt:message key="i18n.getEmailValiCode" /></span>
				</td>
	        </tr>
	        <tr>
      			<td align="right"><fmt:message key="i18n.valicode"/>:</td>
      			<td>
      			<input class="easyui-validatebox srk100" id="cp_validCode"  name="rubDTO.authCode" />
      			<input type="hidden" value="${session.loginName }" id="cp_loginName" />
       			<input type="button" id="cp_loginName_button" value="<fmt:message key="i18n.getVerificationCode"/>" onclick="getVerificationCode('Email','ChangeInfo','#cp_loginName','#cp_loginName_button')"> 
					<!-- <span style="color:red;" id="cp_loginName_show"></span> -->
      			</td>
        	</tr>
			<tr>
				<td align="right" style="border-right: 0px;"></td>
				<td align="left">
					<c:if test="${not empty session.activationTime}">
					<input type="submit" class="cx_an1" value="<fmt:message key="i18n.update"/>" />
					</c:if>
				</td>								
			</tr>
		</table>
   	</form>
    </div>
</div>
<script src="js/jquery.min.js"></script>
<script src="../scripts/user/common.js"></script>
<script type="text/javascript">

function changeBasicInfo(){
	if($('#pi_userName').val()==''){
		alert('The name cannot be empty(姓名不能为空)!');
		$('#pi_userName').focus();
		return false;
	}
	
	if($('#pi_email').val()==''){
		alert('Email address can not be empty(邮件地址不能为空)!');
		$('#pi_email').focus();
		return false;
	}
	
	if($('#pi_passwordAnswer').val()==''){
		alert('Secret security answer allowed is empty(密保答案不允许为空)!');
		$('#pi_passwordAnswer').focus();
		return false;
	}
	
	if($('#cp_validCode').val()==''){
		alert('Verification code cannot be empty(验证码不能为空)!');
		$('#cp_validCode').focus();
		return false;
	}
/* 	
	$.post('activationCode!authEmailCode.action','dto.type=邮件&dto.category=UpdateUser&dto.activationCode='+$('#pi_validCode').val(),function(res){
		 if(!res){
			 alert('E-mail verification code is not correct(邮箱验证码不正确)!');
			 return false;
		 }else{
			 $('#updateInfo_form').submit();
		 }
	}); */
}

$(function(){
	document.onkeydown = function(evt){
		var evt = window.event?window.event:evt;
		if(evt.keyCode==13){
			changeBasicInfo();
		}
	}
	$("#pitable").find("tr").addClass("color1");
	$("#pitable").find("tr:odd").addClass("color2");
	
});	
</script>

				
</body>
</html>